package com.guigu.exception;


import lombok.Data;

/**
 * 自定义异常
 */
@Data
public class GlobalException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private String msg; //异常中的信息

    private int code = 1001; //业务状态码，规则：4位数，从1001开始递增

    private int status = 500; //http状态码，按照http协议规范，如：200,201,400等

    public GlobalException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public GlobalException(String msg, int code, int status) {
        super(msg);
        this.msg = msg;
        this.code = code;
        this.status = status;
    }
    public GlobalException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

}
